﻿using SqlSugar;
using System;

namespace WMS.Model
{
    [SugarTable("RoleMenu")]
    public class RoleMenuModel : BaseModel
    {
        /// <summary>
        /// 角色ID
        /// </summary>
        [SugarColumn(ColumnName = "RoleId", IsNullable = false)]
        public long RoleId { get; set; }

        /// <summary>
        /// 菜单ID
        /// </summary>
        [SugarColumn(ColumnName = "MenuId", IsNullable = false)]
        public long MenuId { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreateTime", DefaultValue = "GETDATE()")]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        // 导航属性 - 角色信息
        [Navigate(NavigateType.OneToOne, nameof(RoleId))]
        public RoleModel Role { get; set; }

        // 导航属性 - 菜单信息
        [Navigate(NavigateType.OneToOne, nameof(MenuId))]
        public MenuModel Menu { get; set; }
    }


    public class RoleMenuModelDTO
    {
        public long RoleId { get; set; }

        public List<long> MenuIds { get; set; }
    }
}